package com.blb.community_admin.service.impl;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.blb.community_admin.entity.ZyRepair;
import com.blb.community_admin.entity.vo.RepairVO;
import com.blb.community_admin.entity.vo.ZyRepairVO;
import com.blb.community_admin.mapper.ZyRepairMapper;
import com.blb.community_admin.service.ZyRepairService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;


@Service
public class ZyRepairServiceImpl extends ServiceImpl<ZyRepairMapper, ZyRepair> implements ZyRepairService {

    @Autowired
    private ZyRepairMapper zyRepairMapper;

    @Override
    public List<ZyRepair> selectpageRepair(RepairVO zyRepairVO) {

        return baseMapper.selectZyRepairList(zyRepairVO,(zyRepairVO.getNowPage()-1)*zyRepairVO.getNowPage(),zyRepairVO.getPageSize());

    }

    @Override
    public List<ZyRepair> selectRepairAll() {
        return baseMapper.selectRepairAll();
    }

    @Override
    public List<ZyRepair> selectRepairByIds(ArrayList<String> repairIds) {
        if (repairIds !=null){
            repairIds=repairIds.size()==0?null:repairIds;
        }
        return baseMapper.selectRepairByIds(repairIds);
    }

//    @Override
//    public IPage<ZyRepairVO> getRepairs(Long current, Long size) {
//        return zyRepairMapper.selectRepairs(new Page<ZyRepairVO>(current,size));
//    }

    @Override
    public IPage<ZyRepairVO> getRepairs(Long current, Long size,String repairState,String ownerRealName,String ownerPhoneNumber,String communityId) {
        return zyRepairMapper.selectRepairs(new Page<ZyRepairVO>(current,size),repairState,ownerRealName,ownerPhoneNumber,communityId);
    }
}
